Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix GH-13727: Building with -Werror=strict-prototypes #14029

Merged
merged 1 commit into from
Apr 22, 2024

Conversation

petk
Copy link
Member

@petk petk commented Apr 21, 2024

This is addon to the GH-13727 bug fix that was fixed in GH-13732. When configuring the build with:

./configure CFLAGS=-Werror=strict-prototypes

libtool check for parsing nm command would fail:

checking command to parse /usr/bin/nm -B output from cc object... failed

Upstream libtool has this specific check already fixed. Note that this works only with Autoconf version 2.72 and later and is preparation for future compilers that might have this error enabled by default.

Copy link
Member

@nielsdos nielsdos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

Copy link
Member

@arnaud-lb arnaud-lb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many checks are at risk of being silently broken by -Werror unfortunately.

The --enable-werror switch adds -Werror to CFLAGS after all checks have run, which avoids this problem.

Unfortunately users may add -Werror manually and unknowingly break something. I don't know if we can do something about this. Maybe error out early if CFLAGS contain Werror? Or remove Werror during checks? Or remove Werror at the beginning of configure and re-add it at the end?

@petk
Copy link
Member Author

petk commented Apr 21, 2024

Compiler might have this enabled by default, so it won't be in the CFLAGS. This above example with CFLAGS is only to test it on compilers without this enabled.

@arnaud-lb
Copy link
Member

Do you know which compilers treat warnings as errors by default? To be clear I don't oppose the change, but I was wondering how we could handle this problem generally

@petk
Copy link
Member Author

petk commented Apr 21, 2024

As far as I understand, Clang 16+ and GCC 14+ on future Fedora systems is one of these examples. Probably also on Gentoo. I have no list of these yet. 🤷 I just follow comments from other PRs in this case :D

Also, from what I read is that when compiler will follow C standards more strictly, this will become an issue. But there's still enough time to fix these kind of syntax before this will be enabled.

Probably @remicollet or @orlitzky might know more here.

@arnaud-lb
Copy link
Member

Do you mean new warnings, or treating them as error by default?

@petk
Copy link
Member Author

petk commented Apr 21, 2024

Do you mean new warnings, or treating them as error by default?

Yes, not only warning, but errors:

@arnaud-lb
Copy link
Member

Thank you!

@orlitzky
Copy link
Contributor

Gentoo is rolling-release, source-based, and has crazy users. As soon as these new compilers are released, they'll be available, and someone will make it his default and try to rebuild his entire system with it.

So +1 for fixing these issues before that guy files a bug about it. Thanks!

This is addon to the phpGH-13727 bug fix. When configuring the build with:

  ./configure CFLAGS=-Werror=strict-prototypes

libtool check for parsing nm command would fail:

  checking command to parse /usr/bin/nm -B output from cc object... failed

Upstream libtool has this specific check already fixed. Note that this
works only with Autoconf version 2.72 and later and is preparation for
future compilers that might have this error enabled by default.
@petk petk force-pushed the patch-GH-13727-strict-prototypes branch from f6b40be to 3a77a7f Compare April 22, 2024 19:20
@petk petk merged commit 44775b7 into php:PHP-8.2 Apr 22, 2024
5 of 8 checks passed
petk added a commit that referenced this pull request Apr 22, 2024
* PHP-8.2:
  Fix GH-13727: Building with -Werror=strict-prototypes (#14029)
petk added a commit that referenced this pull request Apr 22, 2024
* PHP-8.3:
  Fix GH-13727: Building with -Werror=strict-prototypes (#14029)
@petk petk deleted the patch-GH-13727-strict-prototypes branch April 22, 2024 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants